<extend name="./public/frame.html"/>
<block name="content">
    <form class="layui-form" action="/admin/Member/zone" method="post">
        <table class="layui-table">
            <input type="hidden" value="{$data.id}" name="id" id="id">
            <tr>
                <td width="12%">开通会员价格(现价)</td>
                <td>
                    <input type="text" name="member_need_price" id="member_need_price" required lay-verify="required" placeholder="开通会员实际金额" class="layui-input" style="width: 500px;" value="{$data.member_need_price/100}" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')">
                </td>
            </tr>
            <tr>
                <td>开通会员价格(原价)</td>
                <td>
                    <input type="text" name="member_original_price" id="member_original_price" required lay-verify="required" placeholder="开通会员原价" style="width: 500px;" class="layui-input" value="{$data.member_original_price/100}" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')">
                </td>
            </tr>
            <tr>
                <td>会员有效时长</td>
                <td>
                    <input type="text" name="continue_time" id="continue_time" required lay-verify="required" placeholder="会员有效时长" class="layui-input" style="width: 100px;float: left" value="{$data.continue_time}" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')">
                    <div class="layui-input-block" style="width: 100px;">
                        <select name="time_type" lay-verify="required" lay-filter="css" >
                            <option value="1" <?php if($data['time_type'] == 1):?>selected<?php endif;?>>月</option>
                            <option value="2" <?php if($data['time_type'] == 2):?>selected<?php endif;?>>周</option>
                            <option value="3" <?php if($data['time_type'] == 3):?>selected<?php endif;?>>天</option>
                        </select>
                    </div>
                </td>
            </tr>
            <tr>
                <td>打车分润比例 %（一级）</td>
                <td>
                    <input type="text" name="daimond_ratio" id="daimond_ratio" required lay-verify="required" placeholder="打车分润比例 %（一级）" class="layui-input" style="width: 500px;" value="{$data.daimond_ratio}">
                </td>
            </tr>
            <tr>
                <td>打车分润比例 %（二级）</td>
                <td>
                    <input type="text" name="cold_ratio" id="cold_ratio" required lay-verify="required" placeholder="打车分润比例 %（二级）" class="layui-input" style="width: 500px;" value="{$data.cold_ratio}">
                </td>
            </tr>
            <tr style="display: none">
                <td>海购分润比例 %（一级）</td>
                <td>
                    <input type="text" name="gou_first_ratio" id="gou_first_ratio" required lay-verify="required" placeholder="海购分润比例 %（一级）" class="layui-input" style="width: 500px;" value="{$data.gou_first_ratio}">
                </td>
            </tr>
            <tr style="display: none">
                <td>海购分润比例 %（二级）</td>
                <td>
                    <input type="text" name="gou_second_ratio" id="gou_second_ratio" required lay-verify="required" placeholder="海购分润比例 %（二级）" class="layui-input" style="width: 500px;" value="{$data.gou_second_ratio}">
                </td>
            </tr>
            <tr style="display: none">
                <td>海宝分润比例 %（一级）</td>
                <td>
                    <input type="text" name="bao_first_ratio" id="bao_first_ratio" required lay-verify="required" placeholder="海宝分润比例 %（一级）" class="layui-input" style="width: 500px;" value="{$data.bao_first_ratio}">
                </td>
            </tr>
            <tr style="display: none">
                <td>海宝分润比例 %（二级）</td>
                <td>
                    <input type="text" name="bao_second_ratio" id="bao_second_ratio" required lay-verify="required" placeholder="海宝分润比例 %（二级）" class="layui-input" style="width: 500px;" value="{$data.bao_second_ratio}">
                </td>
            </tr>
            <tr>
                <td>分润提现钱包扣税比例(%)</td>
                <td>
                    <input type="text" name="member_wallet_ratio" id="member_wallet_ratio" required lay-verify="required" placeholder="分润提现钱包扣税比例" class="layui-input" style="width: 500px;" value="{$data.member_wallet_ratio}">
                </td>
            </tr>
            <tr>
                <td>分润提现钱包最低金额(%)</td>
                <td>
                    <input type="text" name="member_wallet_min" id="member_wallet_min" required lay-verify="required" placeholder="分润提现钱包最低金额" class="layui-input" style="width: 500px;" value="{$data.member_wallet_min}">
                </td>
            </tr>
            <tr>
                <td>活动内容</td>
                <td>
                    <input type="text" name="content" id="content" required lay-verify="required" placeholder="活动内容" class="layui-input" style="width: 500px;" value="{$data.content}" >
                </td>
            </tr>
            <tr>
                <td>活动说明</td>
                <td>
                    <textarea name="explain" placeholder="活动说明" required lay-verify="required" class="layui-textarea" style="width: 800px;height: 160px;">{$data.explain}</textarea>
                </td>
            </tr>
            <tr>
                <td>推广内容</td>
                <td>
                    <textarea name="active_content" placeholder="推广内容" required lay-verify="required" class="layui-textarea" style="width: 800px;height: 160px;">{$data.active_content}</textarea>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <button class="layui-btn" lay-submit="" lay-filter="submit">立即提交</button>
                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                </td>
            </tr>
        </table>
    </form>
    <script>
        //Demo
       layui.use(['form', 'upload'], function(){
             var form = layui.form;
            //监听提交
             form.on('submit(submit)', function(data){
                 var member_need_price      = $("#member_need_price").val();
                 var member_original_price  = $("#member_original_price").val();
                 var daimond_ratio          = $("#daimond_ratio").val();
                 var cold_ratio             = $("#cold_ratio").val();
                 var continue_time          = $("#continue_time").val();
                 var member_wallet_ratio   = $("#member_wallet_ratio").val();
                 if(member_need_price < 0 || member_original_price < 0){
                     layer.msg('开通会员价格不能小于0',{icon: 5});return false
                 }
                 if(daimond_ratio <= 0 || cold_ratio <= 0){
                     layer.msg('提成比例不能小于等于0',{icon: 5});return false
                 }
                 var re = /^[0-9]+.?[0-9]*$/;
                 if (!re.test(daimond_ratio)) {
                     layer.msg('提成比例请输入数字',{icon: 5});
                     $("#daimond_ratio").val('');
                     return false;
                 }
                 if (!re.test(cold_ratio)) {
                     layer.msg('提成比例请输入数字',{icon: 5});
                     $("#cold_ratio").val('');
                     return false;
                 }
                 if (!re.test(member_wallet_ratio)) {
                     layer.msg('扣税比例请输入数字',{icon: 5});
                     $("#member_wallet_ratio").val('');
                     return false;
                 }
                 if(continue_time <= 0){
                     layer.msg('会员有效时长不能小于等于0',{icon: 5});return false
                 }
             });
        });
    </script>
</block>
